<?php

namespace App\Http\Controllers\Api;

use App\Attachment;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;

class AttachmentController extends Controller
{
    public function destroy(Attachment $attachment)
    {
        Storage::disk('public')->delete($attachment->url);
        $attachment->delete();
        return response(['message' => '删除成功']);
    }
}
